home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0346.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  1.5 KB  |  38 lines

  1. On Fri, 26 May 1978, Morten Bolstad wrote:
  2.  
  3. > Oki, here we go again withanother question.
  4. > Is it slowing the program down if i have alot of procedures
  5. > that the main procedures jumps to and return back to, like this:
  6. > (I have five of the Main procedures)
  7. > Will this be slower than having all the code in Procedure A,B,C,D,E,F ang G
  8. > in gosubs inside the Main1 proceure????
  9. > But then again if i must have all the code in Procedure A-G inside Main 1 
  10. > procedure then i must have all that code inside Main 2-5 also.
  11. > What will be quickest and easiest?????
  12. Use subroutines anywhere speed really matters - the exact same code
  13. takes longer in a procedure because of the time needed to set up the
  14. memory for a procedure - new variables etc. whereas a gosub is simply
  15. a switch in location. Use a mixture of both. Use procedures for things
  16. that aren't speed dependant - setup, load info, save info, highscore,
  17. help screen whatever (I don't know what sort of thing you're writing)
  18. and keep the subs for the in game loop or maths intensive bits or
  19. whatever. The subs may be messier than procs but when compiled who
  20. sees your code anyway?
  21.  
  22. ###       ###  ########  ########### ###########
  23. ####     #### ###    ###     ###         ###
  24. ##!##   ##!## #!#    #!#     #!#         #!#
  25. !#! #!#!# !@! !@!!@@!!@!     !@!         !@!     mattw@netsoc.ucd.ie
  26. !!!   !   !!! !!!    !!!     !!!         !!!            x  x
  27. :!:       :!: :!:    :!:     :!:         :!:            \__/
  28. :::       ::: :::    :::     :::         :::  
  29. ::         :: ::     ::       :           :
  30.  
  31.  
  32.